﻿using System;
using Aquarinum.Base.Infrastructure.Ioc;
using Aquarinum.Util.Interface.Log;
using EasyNetQ;

namespace Aquarinum.Base.Infrastructure.EventBus.Default
{
    /// <summary>
    ///     公共日志组件实现的MqLogger
    /// </summary>
    public class DefaultMqLogger : IEasyNetQLogger
    {
        public void DebugWrite(string format, params object[] args)
        {
            AquainumContainer.Resolve<IAquarinumLogger>().Debug(format);
        }

        public void InfoWrite(string format, params object[] args)
        {
            AquainumContainer.Resolve<IAquarinumLogger>().Info(format);
        }

        public void ErrorWrite(string format, params object[] args)
        {
            AquainumContainer.Resolve<IAquarinumLogger>().Warn(format);
        }

        public void ErrorWrite(Exception exception)
        {
            AquainumContainer.Resolve<IAquarinumLogger>().Error(string.Empty, exception);
        }
    }
}